import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

// global compoments
import navbar from '@/components/NavBar.vue'
import tabbar from '@/components/TabBar.vue'
import button from '@/components/Button.vue'
import verformitem from '@/components/VerticalFormItem.vue'
import download from '@/components/Download.vue'
import modal from '@/components/Modal.vue'
import line from '@/components/Line.vue'
import paypass from '@/components/PayPassword.vue'
import norecord from '@/components/NoRecord.vue'
import reachbottom from '@/components/ReachBottom.vue'
import loadmore from '@/components/MoreLoading.vue'

Vue.use(Router)

Vue.component('NavBarCom', navbar)
Vue.component('TabBarCom', tabbar)
Vue.component('BtnCom', button)
Vue.component('VerFormItem', verformitem)
Vue.component('DownloadCom', download)
Vue.component('ModalCom', modal)
Vue.component('LineCom', line)
Vue.component('PayPasswordCom', paypass)
Vue.component('NoRecordCom', norecord)
Vue.component('ReachBottom', reachbottom)
Vue.component('LoadMoreCom', loadmore)

export default new Router({
  mode: 'hash',//hash or history
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/form',
      name: 'form',
      // route level code-splitting
      // this generates a separate chunk (form.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "form" */ './views/Form.vue')
    },
    {
      path: '/about',
      name: 'about',
      component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
    },
    {
      path: '/i18n',
      name: 'i18n',
      component: () => import(/* webpackChunkName: "about" */ './views/I18n.vue')
    },
    {
      path: '/wxpay',
      name: 'wxpay',
      component: () => import(/* webpackChunkName: "about" */ './views/WxPay.vue')
    },
    {
      path: '/calendar',
      name: 'calendar',
      // component: () => import(/* webpackChunkName: "about" */ './views/Calendar.vue')
      component: () => import(/* webpackChunkName: "about" */ './components/CalendarCom.vue')
    },
    {
      path: '/example',
      name: 'example',
      component: () => import(/* webpackChunkName: "about" */ './views/Example.vue')
    }
  ]
})
